﻿namespace Oblivion.Networking.Packets
{
    public class HandshakePacket
    {
        private readonly Packet pkt;
        public int Port;
        public byte ProtocolVersion;
        public string ServerHost;
        public string Username;

        public HandshakePacket(byte[] data)
        {
            pkt = new Packet(data);
            pkt.ReadPacketType();
            ProtocolVersion = pkt.ReadUInt8();
            Username = pkt.ReadString();
            ServerHost = pkt.ReadString();
            Port = pkt.ReadInt32();

            pkt.FinishReading();
        }
    }
}